# -*- coding: utf-8 -*-

from django.conf import settings
from django.http import HttpRequest
from fiveone import FiveOne

class Wuyao(object):
    def __init__(self, django_request_obj):
        app_key = django_request_obj.REQUEST['51_sig_app_key']
        app = settings.FIVEONE_APPS[app_key]
        self.secret_key = app[0]
        self.api_key = app_key
        self.app_name = app[1]
        self.callback_path = app[2]
        self.fo = FiveOne(api_key=self.api_key, secret_key=self.secret_key, app_name=self.app_name, callback_path=self.callback_path, internal=True)
        
        self.checked = self.fo.check_session(django_request_obj)
        self.name = '51'
        
    
    def getFriendsID(self):
        return self.fo.friends.get(uid=self.fo.user)


    def getFriendsInfo(self):
        return self.fo.friends.get(uid=self.fo.user)


    def areFriends(self, uids1, uids2):
        return self.fo.friends.areFriends(uids1, uids2)


    def getAppUsers(self):
        return self.fo.friends.getAppUsers()


    def getAppFriends(self):
        return self.fo.friends.getAppUsers()
    

    def publishTemplatizedAction(self, template_id, title_data=None, body_data=None, resource_id=None):
        return self.fo.feed.publishTemplatizedAction(template_id, body_data)
    
    
    def getUsersInfo(self, uids, fields):
        return self.fo.users.getInfo(uids=uids,fields=fields)
    

    def getLoggedInUser(self):pass
    

    def isAppAdded(self, uid):pass
    

    def getXNML(self, uid):pass
    

    def setXNML(self, uid, profile, profile_action):pass
    

    def sendNotifications(self, to_ids, notification):pass
    

    def getIsInviters(self, uids):pass
    

    def getOsInfo(self, invite_ids):pass
    

    def getUserOsInviteCnt(self, uids):pass
    

    def getAllocation(self):pass
    

    def regOrder(self, order_id, amount):pass
    

    def isOrderCompleted(self, order_id):pass
    

    def regOrder4Test(self, order_id, amount):pass
    

    def isOrderCompleted4Test(self, order_id):pass